﻿namespace CodeSHARPer.Avalondock.Pane
{
    using AvalonDock.Layout;
    using CodeSHARPer.ViewModel;
    using CodeSHARPer.ViewModel.Tools;
    using System.Windows;
    using System.Windows.Controls;

    class PanesTemplateSelector : DataTemplateSelector
    {
        public PanesTemplateSelector() { }

        public DataTemplate FileViewTemplate { get; set; }

        public DataTemplate RecentFilesViewTemplate { get; set; }

        public DataTemplate WorkingFolderViewTemplate { get; set; }

        public DataTemplate FindAndReplaceViewTemplate { get; set; }

        public override System.Windows.DataTemplate SelectTemplate(object item, System.Windows.DependencyObject container)
        {
            if (item is CodePadViewModel)
                return FileViewTemplate;

            if (item is RecentFilesViewModel)
                return RecentFilesViewTemplate;

            if (item is WorkingFolderViewModel)
                return WorkingFolderViewTemplate;

            if (item is FindReplaceViewModel)
                return FindAndReplaceViewTemplate;

            return base.SelectTemplate(item, container);
        }
    }
}
